package com.zjx.reggie.common;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/*** 全局异常处理 */
@ControllerAdvice(annotations = {RestController.class, Controller.class})
@ResponseBody
@Slf4j
@Order(2)
public class SystemExceptionHandler {
    /*** 异常处理方法 * @return */

    //@ExceptionHandler(Exception.class)
    public R<String> exceptionHandler2(Exception e){
        log.error(e.toString());
        return R.error("服务器繁忙，请稍后再试");
    }
}